'use strict';

module.exports = app => {
  const checkLogin = app.middlewares.checkLogin();

  // main
  app.get('/', checkLogin, 'main.index');

  // login
  app.get('/login', 'main.getLogin');
  app.get('/logout', 'main.getLogout');

  // APIs
  app.post('/login', 'main.login');
  app.get('/test', 'main.test');
  app.get('/api/test', 'main.apitest');
  app.get('/api/v1/upload-token', 'main.uploadToken');
  app.get('/api/v1/message', checkLogin, 'message.list');

  app.post('/api/v1/login', 'main.login')
  app.post('/api/v1/logout', 'main.logout')

  app.resources('article', '/api/v1/article', 'article');
  app.resources('comment', '/api/v1/article/:article_id/comment', 'comment');
  app.resources('reply', '/api/v1/comment/:comment_id/reply', 'reply');


};
